/*
    This file is part of the open source IVMP-MySQL project.

    IVMP-MySQL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    IVMP-MySQL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with IVMP-MySQL.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
	File: Logger.h

	Description:
		Contains a custom logger implementation that can log to both ivmp-mysql.log
		and the main console.
*/

#ifndef IVMP_MYSQL_LOGGER_H
#define IVMP_MYSQL_LOGGER_H

#include <stdio.h>

class Logger
{
public:

	/*
		Initialises the logger, should only be called once during module lifespan.
	*/
	static void Initialise();

	/*
		Closes the log file, if it has been opened.
	*/
	static void Close();

	/*
		Prints a message to the ivmp-mysql.log file. If logToConsole is true, then
		the message is also displayed on the console window (to be used for serious
		errors and whatnot).
	*/
	static void Out(const char* string, bool logToConsole = false);

	static void OutFormat(const char* string, ...);

	static void OutFormatConsole(const char* string, ...);

private:
	static FILE* LogFile;
};

#endif